/*
 * Copyright© 2003-2019 浙江汇信科技有限公司, All Rights Reserved. 
 */
package com.icinfo.cloud.provider.punish.csource.manage.controller;

import com.icinfo.cloud.provider.punish.approval.vo.LineTerritoryInfoVo;
import com.icinfo.cloud.provider.punish.config.service.ISysDepartParamService;
import com.icinfo.cloud.provider.punish.csource.manage.dto.CaseRegisterOfAppSaveDto;
import com.icinfo.cloud.provider.punish.csource.manage.dto.CaseSourceRegisterOfAppSaveDto;
import com.icinfo.cloud.provider.punish.csource.manage.dto.LineInfoOfAppQueryDto;
import com.icinfo.cloud.provider.punish.csource.manage.service.ICaseSourceApiService;
import com.icinfo.framework.common.web.Result;
import com.icinfo.framework.core.web.BaseController;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 【V1.4.0】描述: 案源登记接口Api对应的Controller类
 *
 * @author zhengqiang
 * @date 2022年08月15日
 */
@Slf4j
@RestController
@RequestMapping("/punish/csource/manage/api")
public class CaseSourceApiController extends BaseController {

    @Resource
    private ICaseSourceApiService caseSourceApiService;
    @Resource
    private ISysDepartParamService sysDepartParamService;


    /**
     * 【V1.4.0】描述： 保存外部应用案源登记信息
     *
     * @author: zhengqiang
     * @date: 2022/8/15
     * @param: caseSourceRegisterSaveDto
     * @return {@link Result}
     **/
    @PostMapping(value = "/saveCaseSourceRegisterOfApp")
    public Result<String> saveCaseSourceRegisterOfApp(@RequestBody @Validated CaseSourceRegisterOfAppSaveDto caseSourceRegisterSaveDto) {
        return caseSourceApiService.saveCaseSourceRegisterOfApp(caseSourceRegisterSaveDto);
    }

    /**
     * 【V1.4.0】描述： 保存外部应用案件登记信息
     *
     * @author: zhengqiang
     * @date: 2022/8/15
     * @param: saveDto
     * @return {@link Result< String>}
     **/
    @PostMapping(value = "/saveCaseRegisterOfApp")
    public Result<String> saveCaseRegisterOfApp(@RequestBody @Validated CaseRegisterOfAppSaveDto saveDto) {
        return caseSourceApiService.saveCaseRegisterOfApp(saveDto);
    }

    /**
     * 【V1.4.0】描述： 根据机构编码获取部门条线信息
     *
     * @author: zhengqiang
     * @date: 2022/8/18
     * @param: lineInfoDto
     * @return {@link Result< List< LineTerritoryInfoVo>>}
     **/
    @PostMapping(value = "/getLineInfoListByOrgCodeOfApp")
    public Result<List<LineTerritoryInfoVo>> getLineInfoListByOrgCodeOfApp(@RequestBody @Validated LineInfoOfAppQueryDto lineInfoDto) {
        String orgCode=lineInfoDto.getOrgCode();
        List<LineTerritoryInfoVo> voList = sysDepartParamService.getLineInfoListByOrgCode(orgCode);
        return Result.success(voList);
    }
}